package com.rpc.util.generationid;

import org.apache.commons.configuration2.Configuration;
import org.apache.commons.configuration2.FileBasedConfiguration;
import org.apache.commons.configuration2.PropertiesConfiguration;
import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
import org.apache.commons.configuration2.builder.fluent.Parameters;
import org.apache.commons.configuration2.ex.ConfigurationException;

import java.util.HashMap;

/**
 * @author yanzhuoleo
 * @version V1.0
 * @Description:
 * @date 2018-01-16-下午6:32
 */
public class GenerationIDFactory {
    private volatile static Configuration config = new PropertiesConfiguration();
    private IGenerationID generationIDObject;

    static {
        Parameters params = new Parameters();
        FileBasedConfigurationBuilder<FileBasedConfiguration> builder =
                new FileBasedConfigurationBuilder<FileBasedConfiguration>(
                        PropertiesConfiguration.class)
                        .configure(params.properties().setFileName("generationID.properties"));
        try {
            config = builder.getConfiguration();
        } catch (ConfigurationException cex) {

        }
    }

    public static void main(String[] args) {
        System.out.println(config.getString("uuid"));
    }

}
